<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改活动课内容')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: summernote-css" />
    <link th:href="@{/css/simplemde.min.css}" rel="stylesheet"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-courseContent-edit" th:object="${courseContent}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">课程包ID：</label>
                <div class="col-sm-8">
                    <input name="vendorPackageId" th:field="*{vendorPackageId}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">显示顺序：</label>
                <div class="col-sm-8">
                    <input name="orderNum" th:field="*{orderNum}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">时长：</label>
                <div class="col-sm-8">
                    <input name="durations"  th:field="*{durations}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">标题：</label>
                <div class="col-sm-8">
                    <input name="title" th:field="*{title}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">内容：</label>
                <div class="col-sm-8">
                    <input type="hidden" class="form-control" th:field="*{content}" id="content" name="content">
                    <textarea></textarea>
                </div>
            </div>

<!--            <div class="form-group">-->
<!--                <label class="col-sm-3 control-label">厂商ID：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="vendorId" th:field="*{vendorId}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: summernote-js" />
    <script th:src="@{/js/simplemde.min.js}"></script>
    <script th:inline="javascript">
        var simplemde = new SimpleMDE();
        var prefix = ctx + "system/courseContent";
        $("#form-courseContent-edit").validate({
            focusCleanup: true
        });
        setTimeout(function () {
            var content = $("#content").val();
            simplemde.value(content);
        }, 1500);
        function submitHandler() {
            if ($.validate.form()) {
                var testPlain = simplemde.value();
                $("#content").val(testPlain);
                $.operate.save(prefix + "/edit", $('#form-courseContent-edit').serialize());
            }
        }

    </script>
</body>
</html>